﻿@using ZDSoft.LMS.Domain
@model Role
@{
    ViewBag.Title = "Authorize";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<html>
<head>
    <link rel="Stylesheet" type="text/css" href="@Url.Content("~/Content/Style/dhtmlxtree.css")"/>
    <script  src="@Url.Content("~/Scripts/dhtmlxcommon.js")" type="text/javascript" language="javascript"></script>
    <script  src="@Url.Content("~/Scripts/dhtmlxtree.js")" type="text/javascript" language="javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        var imgPath = '@Url.Content("~/Content/Images/csh_bluebooks/")';
        var tree;
        $(document).ready(function () {
            tree = new dhtmlXTreeObject("tree", "100%", "100%", 0);
            tree.setSkin('dhx_skyblue');
            tree.setImagePath(imgPath);
            tree.enableCheckBoxes(1);
            tree.enableThreeStateCheckboxes(true);
            var xmlPath = '@Url.Content("~/XMLFile.xml")'
            tree.loadXML(xmlPath);


        });
        function checkSystem() {
            $("#systemfunction").val(tree.getAllChecked());
        }
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <div>
            <div id="tree" style="width: 300px; height: 400px; border: 1px solid Silver; overflow: auto;">
                @Html.HiddenFor(Model => Model.ID)
            </div>
            <div>
                <a href="javascript:void(0);" onclick="tree.setCheck(tree.getSelectedItemId(),true);">
                    Check All item</a> <a href="javascript:void(0);" onclick="tree.setCheck(tree.getSelectedItemId(),false);">
                        UnCheck All item</a> <a href="javascript:void(0);" onclick="alert(tree.getAllChecked());">
                            Get list of checked</a>
            </div>
            <div>
                <input id="systemfunction" name="systemfunction" />
                <input type="submit" value="保存配置" onclick="checkSystem()" />
            </div>
        </div>
    }
</body>
</html>
